﻿function changeTab(id) {
    for (i = 1; i < 4; i++) {
        document.getElementById("Divm" + i).style.display = "none";
        document.getElementById("m_" + i).className = "";
    }
    document.getElementById("Divm" + id).style.display = "block";
    document.getElementById("m_" + id).className = "on";
}

function gotoNewURL(id) {
    var value = document.getElementById("value" + id).value;
    if (value.toString() == "代码") {
        return;
    }

    if (id == 1) {
        window.open("http://stock.quote.stockstar.com/" + value + ".shtml");
    } else if (id == 2) {
        window.open("http://stock.quote.stockstar.com/capital_" + value + ".shtml");
    } else if (id == 3) {
        window.open("http://stock.quote.stockstar.com/info/billboard_" + value + ".shtml");
    } else if (id == 4) {
        window.open("http://stock.quote.stockstar.com/info/comment_" + value + ".shtml");
    } else {
        window.open("http://quote.stockstar.com/search.aspx?keyword=" + value);
    }
}
var a = "";
function mouseblur(id) {
    if (document.getElementById("value" + id).value == "") {
        document.getElementById("value" + id).value = "代码";
        document.getElementById("value" + id).style.color = a;
    }
}

function inputclick(id) {
    if (document.getElementById("value" + id).value == "代码") {
        document.getElementById("value" + id).value = "";
        a = document.getElementById("value" + id).style.color;
        document.getElementById("value" + id).style.color = "black";
    }
}
$(document).ready(function () {
    $("#value2").keydown(function (e) {
        if (e.keyCode == 13) {
            gotoNewURL(2);
        }
    });

    $("#value3").keydown(function (e) {
        if (e.keyCode == 13) {
            gotoNewURL(3);
        }
    });

    $("#value4").keydown(function (e) {
        if (e.keyCode == 13) {
            gotoNewURL(4);
        }
    });
});
